﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cesave.Domain.PermisosModule.Entities;
using Cesave.Domain.Core.Specification;
using Cesave.Domain.PermisosModule.Resources;

namespace Cesave.Domain.PermisosModule.Contracts.Areas
{
	public class AreasByJuntaSpecification
		: Specification<Area>
	{

		/// <summary>
		/// 
		/// </summary>
		private Guid _juntaGuid = default(Guid);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="juntaGuid"></param>
		public AreasByJuntaSpecification(Guid juntaGuid)
		{
			if (juntaGuid == Guid.Empty)
				throw new ArgumentException(Messages.exception_InvalidArgument, "juntaGuid");
			_juntaGuid = juntaGuid;
		}

		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public override System.Linq.Expressions.Expression<Func<Area, bool>> SatisfiedBy()
		{
			Specification<Area> specification = new DirectSpecification<Area>(area => area.JuntaGuid == _juntaGuid);
			return specification.SatisfiedBy();
		}
	}
}
